<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>unlink execCommand bug</title>
	<script type="text/javascript">

window.onload = function()
{
	// Enable editing when the page.
	document.designMode = 'on' ;

	// Remove the links
	var links = document.getElementsByTagName( 'a' );
	for(var i = links.length-1 ; i >= 0 ; i--)
	{
		var link = links[i] ;
		selectNode( link ) ;
		document.execCommand( 'unlink', false, null ) ;
	}

	window.getSelection().removeAllRanges() ;
	alert( document.getElementById( 'test' ).innerHTML );
}

function selectNode( element )
{
	var oRange = document.createRange() ;
	oRange.selectNode( element ) ;

	var oSel = window.getSelection() ;
	oSel.removeAllRanges() ;
	oSel.addRange( oRange ) ;
}
	</script>
</head>
<body>
	<p id="test">
		<a href="#" class="myClass">This link as a class</a>, <a href="#">the second one doesn't</a>
	</p>
	<p>
		Description:<br>
		After removing both links with execCommand("unlink", false, null) the first one will turn into a span. <br>
		The script will show the innerHTML of the first paragraph after execution of the calls
	</p>
</body>
</html>
